<template>
	<view class="container">
		<view class="info-modular">
			<view class="info-modular-header">
				电池信息
			</view>
			<view class="info-modular-list">
				<view class="info-item ">
					<text class="titile">电芯类型</text>
					<text class="data">{{this.batteryTypeStr}}</text>
				</view>
				<view class="info-item ">
					<text class="titile">电芯电压</text>
					<text class="data">{{this.batteryVoltage}}mV</text>
				</view>
			</view>
		</view>
		<view class="info-modular">
			<view class="info-modular-header">
				BMS信息
			</view>
			<view class="info-modular-list">
				<view class="info-item ">
					<text class="titile">项目名</text>
					<text class="data">{{this.projectName}}</text>
				</view>
				<view class="info-item ">
					<text class="titile">用户项目号</text>
					<text class="data">-</text>
				</view>
				<view class="info-item ">
					<text class="titile">厂商</text>
					<text class="data">-</text>
				</view>
				<view class="info-item ">
					<text class="titile">软件版本</text>
					<text class="data">{{this.softwareVersion}}</text>
				</view>
				<view class="info-item ">
					<text class="titile">SIM卡</text>
					<text class="data">-</text>
				</view>
				<view class="info-item ">
					<text class="titile">DTU ID</text>
					<text class="data">-</text>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		
		data() {
			return {
				softwareVersion:"",
				deviceSerialNum:"",
				BMSFactory_ID:"",
				deviceMCUID_01:"",
				customer_ID:"",
				batteryVoltage:"",
				batteryTypeStr:"",
				projectName:"",
				capcity:""
			};
		},
		onLoad(options) {
		  // options 是传递过来的参数对象
		  this.deviceSerialNum =options.deviceSerialNum;
		  if(this.deviceSerialNum){
			  this.getUser()
		  }
		  
		},
		methods: {
			getUser() {
				console.log(this.$api)
			    let sendData = {
			    	userId: this.deviceSerialNum+"",
			    }
			    console.log(sendData)
			    this.$api({
			    	url: '/api/deviceInfo/getDeviceInfo',
			    	header: 'form',
			    	data: sendData
			    }).then((res) => {
					 
			    	let {
			    		code,
			    		msg,
						data
			    	} = res
					if(res.code==0){
						let{
							softwareVersion,
							deviceSerialNum,
							BMSFactory_ID,
							deviceMCUID_01,
							customer_ID,
							batteryVoltage,
							batteryTypeStr,
							projectName,
							capcity
						}=res.data
						this.softwareVersion=res.data.softwareVersion
						this.deviceSerialNum=res.data.deviceSerialNum
						this.BMSFactory_ID=res.data.BMSFactory_ID
						
						this.deviceMCUID_01=res.data.deviceMCUID_01
						this.customer_ID=res.data.customer_ID
						this.capcity=res.data.capcity
						this.batteryVoltage=res.data.batteryVoltage
						this.batteryTypeStr=res.data.batteryTypeStr
						this.projectName=res.data.projectName
					}
			    	console.log(res.data)
			    })
			},
		},
	}
</script>

<style lang="scss">
	.info-modular-header{
		height:100rpx;
		padding: 0 30rpx;
		line-height: 100rpx;
		font-size: 30rpx;
		color: #969696;
	}
	.info-modular-list{
		background-color: #ffffff;
		padding:0 30rpx;
		.info-item{
			display: flex;
			align-items: center;
			height: 100rpx;
			line-height: 100rpx;
			border-bottom: 1px solid #f7f7f7;
			text{
				font-size: 30rpx;
				color: #969696;
			}
			.titile{
				margin-right: 30rpx;
			}
			.data{
				font-weight: 600;
				color: #333333;
			}
			
		}
	}

</style>
